-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render drop shadow for active window #58
Conversation
61764af
to
94f960d
Compare
Because I'm still unsure where to place the blur operation, whether to implement the blur in '_twin_widget_queue_paint()', as this function handles the rendering order of each widget object. It would need to read the corresponding pixel block currently on the screen during rendering to blur the current background. Or should I implement this operation when each widget's TwinEventPaint occurs? So I first try to implement this function on the background to see its effect. |
Alternatively, you can write an image viewer with drop shadow functionality to evaluate performance and visual effects in the initial stage. Once you have a better understanding of the window manager events and their flow, we can proceed with integrating it into the window system. See MDN: drop-shadow |
For performance evaluation, you may consider the code mentioned in #55 (comment) . |
94f960d
to
5dda144
Compare
I haven't applied stack blur to the drop shadow yet, because I don't know how to access the current screen's topmost pixel map. I want to apply the stack blur to a specific region of the topmost pixel map that overlaps with the shadow and then use this as the new shadow. The topmost pixel map is efficiently updated by refreshing only the damaged areas. |
a78fc51
to
3433384
Compare
Compilation error/warning reported by Clang:
|
3433384
to
dcbefd0
Compare
I am unsure how to validate this. Could you provide the relevant procedures or methods along with the expected behavior? |
dcbefd0
to
397f8e9
Compare
The blur appeared too strong and spread out compared to typical drop shadow effects found in compositing window managers. Would you adjust the Gaussian kernel to create a tighter, more natural-looking shadow? |
Do you want to directly reduce kernel size or use the gradient method to reduce kernel size? |
For window compositing, the blur effect should only be applied to the window decorator when creating drop shadows, not to the entire window. The kernel size shrinks. |
397f8e9
to
e403354
Compare
Do all windows need to have the drop shadow feature? And only the window on the top layer will display the drop shadow. |
Blur effects are only applied to the active window, using drop shadow to make it visually distinct. |
e403354
to
80bd59e
Compare
The latest update enforces blur effects on the active window, matching the standard behavior of compositing window managers. To enhance the visual depth, we should replace the right and bottom window borders with drop shadows, creating darker edges that give a more dimensional appearance. This means disabling the standard border rendering on those sides and implementing drop shadow effects instead. Reference video: Apply Blur to xfce 4 Desktop Manager |
Yes, exactly. |
80bd59e
to
a78fe42
Compare
Code Review Agent Run #4bda41Actionable Suggestions - 6
Review Details
|
ed659ba
to
5f47a9a
Compare
Code Review Agent Run #32aeb7Actionable Suggestions - 6
Review Details
|
5f47a9a
to
7f7310c
Compare
Code Review Agent Run #c6fdc0Actionable Suggestions - 1
Review Details
|
Implement the twin_window_drop_shadow() function to handle the pixels within the drop shadow area of the active window's pixel map. The drop shadow effect of the window is only visible when the window is on the top layer, ensuring the active window stands out visually. Add the twin_stack_blur() function to implement Mario's Stack Blur algorithm, which blurs the target pixel map. Additionally, create a blur window in apps_blur() to show the effect of twin_stack_blur(). Implement the twin_shadow_border() function to create a darker border of the active window that gives a more dimensional appearance. The function twin_window_drop_shadow() will first apply the twin_shadow_border() and then apply twin_stack_blur() to blur the darker border. Furthermore, implement the twin_cover() function to cover the target pixels with the desired color. Ref: https://melatonin.dev/blog/implementing-marios-stack-blur-15-times-in-cpp/ Close sysprog21#34 Signed-off-by: Wei-Hsin Yeh <[email protected]>
7f7310c
to
d493323
Compare
Code Review Agent Run #ff7540Actionable Suggestions - 6
Additional Suggestions - 1
Review Details
|
Thank @weihsinyeh for contributing! |
Use Pascal's Triangle to approximate a 5x5 Gaussian Kernel, and apply Gaussian blur on the
twin_pixmap_t
to implement the blurring technique.See: #34
Summary by Bito
This PR introduces configurable drop shadow effects for active windows using an optimized stack blur algorithm. The implementation includes customizable shadow offsets, blur radius, and color settings through Kconfig. The changes focus on window rendering and pixmap handling, with performance optimizations in the blur implementation.Unit tests added: False
Estimated effort to review (1-5, lower is better): 3